﻿@using OpenData.Framework;

@{
    ViewBag.Title = "Home Page";
    //using (var db = new OpenDatabase("test"))
    //{


    //    dynamic entity = new OpenEntity() { UUID = "test" };
    //    db.Entity("test").Schema.InsertColumn(new Column()
    //    {
    //        Name = "FirstName",
    //        AllowNull = true,
    //        DefaultValue = ""
    //    });
    //    db.Entity("test").Schema.InsertColumn(new Column()
    //    {
    //        Name = "Name",
    //        AllowNull = true,
    //        DefaultValue = ""
    //    });
    //    db.Entity("test").Schema.InsertColumn(new Column()
    //    {
    //        Name = "LastName",
    //        AllowNull = true,
    //        DefaultValue = ""
    //    });
    //    entity.Name = "test";
    //    entity.FirstName = "Adm";
    //    entity.LastName = "Zhu";
    //    db.Entity("test").Insert(entity);


    //}
}
<div id="row" class="row">

    <div id="accordion-resizer">

        <div id="accordion">

            <h3>系统设置</h3>

            <div>

                <ul id="menu">

                    <li class="open-tab"><span class="ui-icon ui-icon-disk"></span>Save</li>

                    <li class="open-tab"><span class="ui-icon ui-icon-zoomin"></span>Zoom In</li>

                    <li class="open-tab"><span class="ui-icon ui-icon-zoomout"></span>Zoom Out</li>

                    <li class="open-tab"><span class="ui-icon ui-icon-print"></span>Print...</li>

                    <li>

                        Playback

                        <ul>

                            <li><span class="open-tab"></span>Prev</li>

                            <li><span class="open-tab"></span>Stop</li>

                            <li><span class="open-tab"></span>Play</li>

                            <li><span class="open-tab"></span>Next</li>

                        </ul>

                    </li>

                    <li onclick="test()">Learn more about this menu</li>

                </ul>




            </div>

            <h3>微信设置</h3>

            <div>

                <p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p>

            </div>

            <h3>客户设置</h3>

            <div>

                <p>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </p>

                <ul>

                    <li>List item one</li>

                    <li>List item two</li>

                    <li>List item three</li>

                </ul>

            </div>

            <h3>Section 4</h3>

            <div>

                <p>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>

            </div>

        </div>

    </div>

    <div id="tabs">
        <ul></ul>
    </div>


</div>





<style>
    #accordion-resizer {
        padding: 10px;
        width: 20%;
        height: 700px;
        float: left;
    }

    #tabs {
        padding: 10px;
        width: 80%;
        height: 700px;
        border: none;
        float: right;
    }

    .ui-menu {
        width: 150px;
    }
</style>


@section Scripts {


    <script>
        var tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close' role='presentation'>Remove Tab</span></li>",

        tabCounter = 2;












        $(function () {

            $("#accordion").accordion({

                heightStyle: "fill"

            });

            $("#accordion-resizer").resizable({

                minHeight: 700,

                minWidth: 20,

                resize: function (event, ui) {

                    var width = $("#row").width() - ui.size.width - 10;
                    $("#tabs").css("width", width);
                    $("#accordion").accordion("refresh");
                }

            });


            $("#menu").menu();



            var tabs = $("#tabs").tabs();


            // close icon: removing the tab on click

            tabs.delegate("span.ui-icon-close", "click", function () {

                var panelId = $(this).closest("li").remove().attr("aria-controls");

                $("#" + panelId).remove();

                tabs.tabs("refresh");

            });



            tabs.bind("keyup", function (event) {

                if (event.altKey && event.keyCode === $.ui.keyCode.BACKSPACE) {

                    var panelId = tabs.find(".ui-tabs-active").remove().attr("aria-controls");

                    $("#" + panelId).remove();

                    tabs.tabs("refresh");

                }

            });


            $(".open-tab").click(function () {
                var label = $(this).text();
                var id = "tabs-" + tabCounter;
                var li = $(tabTemplate.replace(/#\{href\}/g, "#" + id).replace(/#\{label\}/g, label));
                var tabContentHtml =   "Tab " + tabCounter + " content.";
                 
                tabs.find(".ui-tabs-nav").append(li);

                //tabs.append("<div id='" + id + "'><p>" + tabContentHtml + "</p></div>");

                tabs.tabs("refresh");

                tabCounter++;
            });

        });

    </script>
    @Scripts.Render("~/bundles/jqueryval")
}
